/*
 * RandomGainMapModel.cc
 *
 * @created Apr 18, 2013
 * @author Tim Niggemann, III Phys. Inst. A, RWTH Aachen University
 * @copyright GNU General Public License v3.0
 */

#include "model/impl/G4SipmRandomGainMapModel.hh"

#include <CLHEP/Random/RandGauss.h>

#include "model/G4SipmModel.hh"

G4SipmRandomGainMapModel::G4SipmRandomGainMapModel() : G4SipmGainMapModel(), model(NULL)
{
	//
}

void G4SipmRandomGainMapModel::refresh(const G4SipmModel *const _model)
{
	model = _model;
}

bool G4SipmRandomGainMapModel::needsRefresh()
{
	return model == NULL;
}
// 获取增益值，增益值为高斯（正态分布）分布的随机数。高斯分布的均值（μ）为1.0，标准差（σ）为模型定义的增益变化量。
double G4SipmRandomGainMapModel::getGain(const G4SipmCellId) const
{
	return CLHEP::RandGauss::shoot(1., model->getGainVariation());
}
